import java.io.File;
import java.io.IOException;

public class Demo5 {
    public static void main(String[] args) throws IOException {
        File file1 = new File("./test.txt");
        System.out.println(file1.createNewFile());
        File file2 = new File("testDir/aaa/test.txt");
        // 更改路径
        System.out.println(file1.renameTo(file2));

    }
}
